package com.we.tickets.controller;

import com.alibaba.fastjson.JSONObject;
import com.we.tickets.service.EventService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/event")
public class EventController {
    @Autowired
    private EventService eventService;

    @PostMapping("/createEvent")
    public JSONObject createEvent(@RequestBody JSONObject jsonObject) {
        return eventService.createEvent(jsonObject);
    }

    @GetMapping("/getAllEvents")
    public JSONObject getAllEvents() {
        return eventService.getAllEvents();
    }

    @PostMapping("/getEventBasicInfo")
    public JSONObject getEventBasicInfo(@RequestBody JSONObject jsonObject) {
        return eventService.getEventBasicInfo(jsonObject);
    }

    @PostMapping("/getEventDetails")
    public JSONObject getEventDetails(@RequestBody JSONObject jsonObject) {
        return eventService.getEventDetails(jsonObject);
    }

    @PostMapping("/getEventsOfOrganizer")
    public JSONObject getEventsOfOrganizer(@RequestBody JSONObject jsonObject) {
        return eventService.getEventsOfOrganizer(jsonObject);
    }

    @PostMapping("/getTicketsByEventId")
    public JSONObject getTicketsByEventId(@RequestBody JSONObject jsonObject) {
        return eventService.getTicketsByEventId(jsonObject);
    }

    @PostMapping("/getTicketById")
    public JSONObject getTicketById(@RequestBody JSONObject jsonObject) {
        return eventService.getTicketById(jsonObject);
    }

}
